#include <iostream>
#include <vector>
using namespace std;

signed main()
{
    string s1,s2;
    cin>>s1>>s2;
    vector<char> v;
    int i = 0,j = 0;
    for(;i<s1.size()&&j<s2.size();i++){
        if(s1[i]!=s2[j]){
            if(s1[i]>='a')    v.push_back(s1[i]-32);
            else    v.push_back(s1[i]);
        }
        else    j++;
    }
    while(i<s1.size())
        if(s1[i]>='a')    v.push_back(s1[i++]-32);
        else    v.push_back(s1[i++]);
    int f[1000] = {0};
    for(int i=0;i<v.size();i++)    if(!f[v[i]]++)    cout<<v[i];
    return 0;
}
